// 统一请求路径前缀在libs/axios.js中修改
import {
  getRequest,
  postRequest,
  deleteRequest,
  uploadFile,
  managerUrl,
} from "@/libs/axios";

// 获取场地分页列表
export const postYardPage = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/site/site/pagelist`, params, headers);
};

// 新增/编辑场地
export const postYardSave = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/site/site/save`, params, headers);
};

// 获取场地地址列表
export const getYardAddress = () => {
  return getRequest(`${managerUrl}/manager/site/site/list`);
};

// 上传场地封面
export const postUpload = (params) => {
  let headers = { 'Content-Type': 'multipart/form-data' };
  return postRequest(uploadFile, params, headers);
};

// 删除场地
export const delYard = (ids) => {
  return deleteRequest(`${managerUrl}/manager/site/site/${ids}`);
};

// 保存预约时段设置
export const postYardTime = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/site/site/updateSiteTime`, params, headers);
};

// 查询场地预约时段
export const getYardTime = (id) => {
  return getRequest(`${managerUrl}/manager/site/site/time/${id}`);
};

// 删除预约时段
export const delYardTime = (id) => {
  return deleteRequest(`${managerUrl}/manager/site/siteTime/deleteTime/${id}`);
};

// 禁-启用场地状态
export const getYardStatus = (params) => {
  return postRequest(`${managerUrl}/manager/site/site/updateStatus/${params.siteId}/${params.type}`);
};

// 获取场地详情
export const getYardDetail = (id) => {
  return getRequest(`${managerUrl}/manager/site/site/${id}`);
};